package interfaces;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;

import Script.Offset;
import Script.JTableFile;
import Pointers.JPointerFactory.PointerType;

public interface ScriptDumper {
	
	/**
	 * Dumps the content of a file into a
	 * text document, using a user submitted
	 * tablefile for conversions.
	 * 
	 * @param textStart Position in file to start dumping from. (inclusive)
	 * @param textStop 	Position in file to stop dumping at. (exclusive)
	 * @param header 	Amount of header bytes a file has, used to
	 * 				 	recalculate pointer data.
	 * @param pOffsets 	All offsets to read pointers from.
	 * @param pType 	Pointer type.
	 * @param textBlock Pointers whos scope is narrower than the
	 * 					total file size needs a preceeding address
	 * 					block to function within. A 2-byte pointer
	 * 					that is supposed to point within E4[00 00]
	 * 					to E4[FF FF] should be supplied with
	 * 					the Long value of &hE40000. Any values within
	 * 					that offset will be nullified (E40F01 -> E40000).
	 * @param table 	Tablefile to convert byte data. 
	 * @param filePath 	Filepath to write the dumped text document to.
	 * 				   	Can include filename, otherwise a default name
	 * 				   	will be used.
	 * @param fixedValueLength 	The number of characters the games fixed length
	 * 						   	strings consists of, otherwise 0. Setting this
	 * 						   	to a value higher than 0 will cause the dumper
	 * 							to split the text between the start and stop
	 * 							offset into chunks of n characters, and print
	 * 							them to their own lines in the script. Each
	 * 							line will be terminated using <END>, even if
	 * 							no <END> tag has been specified by the pointer
	 * 							file. Fixed length dumping does not support DTE.
	 * 							This value includes any ending bytes used to
	 * 							terminate a string.
	 * @param fixedValuePadding The byte value that is used to pad the remaining
	 * 							space after a text of fixed length has been 
	 * 							inserted. When dumping, the first occurence
	 * 							of this byte will cause the dumping to
	 * 							terminate, unless an <end> byte has been
	 * 							specified in the pointerfil and found prior
	 * 							to this value.
	 * @return 			List of errors occured during dumping.
	 * @throws IOException 
	 * @throws FileNotFoundException 
	 */
	public ArrayList<ErrorReport> dump(Offset textStart, Offset textStop,
			   				long header, ArrayList<Offset> pOffsets, 
			   				PointerType pType, long textBlock, JTableFile table, 
			   				String filePath, int fixedValueLength,
			   				byte fixedValuePadding) throws FileNotFoundException, IOException;
	
}
